package org.moonshot.chatty;

import org.moonshot.chatty.lex.ChattyLexeme;

public class ChattyParseException extends Exception
{
    private static final long serialVersionUID = 3682208337065091317L;
    
    private final ChattyLexeme item;
    private final int start;
    private final int end;
    
    private final String problem;
    
    public ChattyParseException(int aStart, int aEnd, ChattyLexeme aLexeme, String aProblem)
    {
        start = aStart;
        end = aEnd;
        item = aLexeme;
        problem = aProblem;
    }
    
    public String getProblem ()
    {
        return problem;
    }
    
    public String toString ()
    {
        return "at "+start+": "+getProblem ();
    }
    
    public int getStart ()
    {
        return start;
    }
    
    public int getEnd ()
    {
        return end;
    }
    
    public ChattyLexeme getLexeme ()
    {
    	return item;
    }
}
